import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/Index'
import Recommend from '@/components/Recommend'
import Job from '@/components/Job'
import Company from '@/components/Company'
import School from '@/components/School'
import Internship from '@/components/Internship'
import SearchResult from '@/components/SearchResult'
import JobDetail from '@/components/JobDetail'
import CompanyDetail from '@/components/CompanyDetail'
import Login from '@/components/Login'
import Register from '@/components/Register'
import Message from '@/components/Message'
import Person from '@/components/Person'
import Resume from '@/components/Resume'
import notFound from '@/components/notFound'
import Area from '@/components/Area'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index,
    },
    {
      path: '/recommend',
      name: 'Recommend',
      component: Recommend
    },
    {
      path: '/job',
      name: 'Job',
      component: Job
    },
    {
      path: '/company',
      name: 'Company',
      component: Company
    },
    {
      path: '/internship',
      name: 'Internship',
      component: Internship
    },
    {
      path: '/school',
      name: 'School',
      component: School
    },
    {
      path: '/search_result',
      name: 'SearchResult',
      component: SearchResult
    },
    {
      path: '/job_detail',
      name: 'JobDetail',
      component: JobDetail
    },
    {
      path: '/company_detail',
      name: 'CompanyDetail',
      component: CompanyDetail
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
    {
      path: '/message',
      name: 'Message',
      component: Message
    },
    {
      path: '/person',
      name: 'Person',
      component: Person
    },
    {
      path: '/resume',
      name: 'Resume',
      component: Resume
    },
    {
      path: '/area',
      name: 'Area',
      component: Area
    },
    {
      path: '/admin_index'
    },
    {
      path: '/admin_login'
    },
    {
      path: '/admin_register'
    },
    {
      path: '/404',
      name: 'notFound',
      component: notFound
    },
    // {
    //   path: "*",
    //   redirect: "/404",
    // }
  ],
  // 切换页面自动回到头部
  scrollBehavior (to, from, saveTop) {
    if (saveTop) {
      return saveTop
    } else {
      return {x: 0, y: 0}
    }
  },

})

